<?php
// +----------------------------------------------------------------------
// | Created by PHPstorm: [ JRK丶Admin ]
// +----------------------------------------------------------------------
// | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved.
// +----------------------------------------------------------------------
// | SiteUrl: http://www.luckyhhy.cn
// +----------------------------------------------------------------------
// | Author: LuckyHhy <jackhhy520@qq.com>
// +----------------------------------------------------------------------
// | Date: 2020/6/26 0026
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------

namespace app\admin\controller;

use app\common\controller\AdminBaseController;
use app\common\model\tang\SendConfig as SendModel;

class SaleConfig extends AdminBaseController
{
    protected function initialize()
    {
        parent::initialize(); // TODO: Change the autogenerated stub
        $this->model = new SendModel();
    }

    public function index()
    {
   
        if(IS_AJAX){
            $result = (new SendModel())->find(1);
            return parent::ajaxResult($result->toArray());
        }
        return $this->fetch();
    }
    public function saveconfig(){
        $param = $this->request->param();
        $id = $param['id'];
        unset($param['id']);
        $result = (new SendModel())->update($param,['id'=>$id]);
        if($result){
            return self::ajaxResult([],0,1,'编辑成功');
        }else{
            return self::ajaxResult([],0,-1,'编辑失败');
        }
    }
}